package com.example.mapper;

import com.example.model.room.Room;
import com.example.model.room.RoomAddRequest;
import com.example.model.room.RoomAllInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface RoomMapper {

    //新增房间
    Long save(RoomAddRequest roomAddRequest);

    //更新房间信息
    Boolean update(RoomAddRequest roomInfo);

    //根据酒店id查询房间
    List<RoomAllInfo> getByHotelId(Long id);

    //获取所有房间信息
    List<RoomAllInfo> getRoomAll(Long hotelId, Integer type, Integer minPrice, Integer maxPrice, String city);

    List<RoomAllInfo> searchRooms(Long hotelId,Integer type, Integer minPrice, Integer maxPrice);

    //设置房间状态
    @Update("update rooms set room_status=#{status} where id=#{id}")
    Boolean setRoomStatus(Long id, Integer status);

    //根据id获取房间状态
    @Select("select room_status from rooms where id=#{id};")
    Integer getRoomStatus(Long id);
}
